<?php


namespace App\Dao;


use App\Exception\BusinessException;
use App\Model\Setting;

class SetDao
{
    public function getById($id)
    {
        $model = Setting::query()->find($id);
        if (empty($model)) {
            throw new BusinessException('记录不存在');
        }
        return $model;
    }

    public function saveByType($data)
    {
        $model = Setting::query()->find($data['id']);
        if (empty($model)) {
            throw new BusinessException('记录不存在');
        }
        $model->update($data);
    }
}